package file1;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

public class Test05 {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        while (true) {
            System.out.println("请输入文件：");
            String name = scan.next();
            File file = new File("./" + name+".txt");
            if (!file.exists()) {
                file.createNewFile();
                System.out.println("创建成功");
                break;
            } else {
                System.out.println("文件已存在请重新输入：");

            }


        }

    }
}
